﻿namespace ESRI.ArcGIS.Client.Tasks.Async
{
    public partial class RouteTaskResult
    {
        /// <summary>
        /// Barriers are returned only if BaseRouteParameters.ReturnBarriers was set to true (which is not the default).
        /// If you send in the barriers as a featureSet (instead of using DataLayer), you already have the barriers
        /// and might not need to request them back from the server.  
        /// </summary>
        public Graphic[] Barriers { get; set; }

        /// <summary>
        /// Facilities are returned only if RouteClosestFacilityParameters.ReturnFacilities or
        /// RouteServiceAreaParameters.ReturnFacilities was set to true. 
        /// </summary>
        public Graphic[] Facilities { get; set; }

        /// <summary>
        /// Incidents are returned only if RouteClosestFacilityParameters.ReturnIncidents was set to true
        /// (which is not the default).  
        /// </summary>
        public Graphic[] Incidents { get; set; }

        /// <summary>
        /// The solution messages (if returned in the server response) are an array of GPMessage instances. 
        /// </summary>
        public GPMessage[] Messages { get; set; }

        /// <summary>
        /// Polygon barriers are returned only if BaseRouteParameters.ReturnPolygonBarriers was set to true
        /// (which is not the default).
        /// </summary>
        public Graphic[] PolygonBarriers { get; set; }

        /// <summary>
        /// Polyline barriers are returned only if BaseRouteParameters.ReturnPolylineBarriers was set to true
        /// (which is not the default).
        /// </summary>
        public Graphic[] PolylineBarriers { get; set; }

        /// <summary>
        /// The route results is an array of RouteResult instances.
        /// </summary>
        public RouteResult[] RouteResults { get; set; }

        /// <summary>
        /// Service area polygons are returned from RouteTask.SolveClosestFacilityAsync
        /// </summary>
        public Graphic[] ServiceAreaPolygons { get; set; }

        /// <summary>
        /// Service area polylines are returned from RouteTask.SolveClosestFacilityAsync
        /// </summary>
        public Graphic[] ServiceAreaPolylines { get; set; }

        internal RouteTaskResult(RouteEventArgs eventArgs)
        {
            Barriers = eventArgs.Barriers;
            Facilities = eventArgs.Facilities;
            Incidents = eventArgs.Incidents;
            Messages = eventArgs.Messages;
            PolygonBarriers = eventArgs.PolygonBarriers;
            PolylineBarriers = eventArgs.PolylineBarriers;
            RouteResults = eventArgs.RouteResults;
            ServiceAreaPolygons = eventArgs.ServiceAreaPolygons;
            ServiceAreaPolylines = eventArgs.ServiceAreaPolylines;
        }
    }
}